package com.kfc.platform.user.server.test;



import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;
import com.kfc.platform.util.DateFormat;
import com.kfc.platform.user.domain.Student;
import com.kfc.platform.user.domain.Teacher;
import com.kfc.platform.user.domain.User;
import com.kfc.platform.user.service.StudentService;
import com.kfc.platform.user.service.TeacherService;
import com.kfc.platform.user.service.UserService;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("/applicationContext.xml")
@Transactional
public class TSTestCase {
	@Autowired
	private TeacherService teacherService;
	@Autowired
	private StudentService studentService;
	@Test
	@Rollback(false)
	public void testCreateTeacherandStudent(){
	    Teacher teacher = new Teacher();
		Student student = new Student();
		teacher.setName("adaf");
		teacher.setClassnum("3");
		student.setName("gdgd");
		student.setClassnum("3");
//		teacher.getStudent().add(student);
		student.setTeacher(teacher);
//		String str = teacherService.createTeacher(teacher);
//		System.out.println("from:"+str);
		String str2 = studentService.createStudent(student);
		System.out.println("from2:"+str2);
	}
	@Test
	public void testget(){
		List<Object[]> list = new ArrayList<Object[]>();
		list = studentService.findSthById(1);
//		list = studentService.findStudentByName("asd");
		for(Object[] s:list){
			System.out.println(s[0]+"----"+s[1]);
		}
	}
	
}
